home *** CD-ROM | disk | FTP | other *** search
/ Amiga Developer CD 2.1 / Amiga Developer CD v2.1.iso / Reference / Includes_and_Autodocs_3.5 / include / devices / hardblocks.h < prev    next >
Encoding:
C/C++ Source or Header  |  1999-10-21  |  9.8 KB  |  221 lines

  1. #ifndef    DEVICES_HARDBLOCKS_H
  2. #define    DEVICES_HARDBLOCKS_H
  3. /*
  4. **    $VER: hardblocks.h 44.2 (20.10.1999)
  5. **    Includes Release 44.1
  6. **
  7. **    File System identifier blocks for hard disks
  8. **
  9. **    (C) Copyright 1988-1999 Amiga, Inc.
  10. **    (C) Copyright 1999 Joanne Dow licensed to Amiga, Inc.
  11. **        All Rights Reserved
  12. */
  13.  
  14. /*    Changes
  15. **      Expanded envec
  16. **      Added storage for driveinit name up to 31 letters.
  17. **      Added storage for filesysten name up to 83 letters.
  18. **/
  19.  
  20. #ifndef EXEC_TYPES_H
  21. #include <exec/types.h>
  22. #endif /* EXEC_TYPES_H */
  23.  
  24.  
  25. /*--------------------------------------------------------------------
  26.  *
  27.  *    This file describes blocks of data that exist on a hard disk
  28.  *    to describe that disk.    They are not generically accessable to
  29.  *    the user as they do not appear on any DOS drive.  The blocks
  30.  *    are tagged with a unique identifier, checksummed, and linked
  31.  *    together.  The root of these blocks is the RigidDiskBlock.
  32.  *
  33.  *    The RigidDiskBlock must exist on the disk within the first
  34.  *    RDB_LOCATION_LIMIT blocks.  This inhibits the use of the zero
  35.  *    cylinder in an AmigaDOS partition: although it is strictly
  36.  *    possible to store the RigidDiskBlock data in the reserved
  37.  *    area of a partition, this practice is discouraged since the
  38.  *    reserved blocks of a partition are overwritten by "Format",
  39.  *    "Install", "DiskCopy", etc.  The recommended disk layout,
  40.  *    then, is to use the first cylinder(s) to store all the drive
  41.  *    data specified by these blocks: i.e. partition descriptions,
  42.  *    file system load images, drive bad block maps, spare blocks,
  43.  *    etc.
  44.  *
  45.  *    Though all descriptions in this file contemplate 512 blocks
  46.  *    per track this desecription works functionally with any block
  47.  *    size. The LSEG blocks should make most efficient use of the
  48.  *    disk block size possible, for example. While this specification
  49.  *    can support 256 byte sectors that is deprecated at this time.
  50.  *
  51.  *    This version adds some modest storage spaces for inserting
  52.  *    the actual source filename for files installed on the RDBs
  53.  *    as either DriveInit code or Filesystem code. This makes
  54.  *    creating a mountfile suitable for use with the "C:Mount"
  55.  *    command that can be used for manually mounting the disk if
  56.  *    ever required.
  57.  *
  58.  *------------------------------------------------------------------*/
  59.  
  60. /*
  61.  *  NOTE
  62.  *    optional block addresses below contain $ffffffff to indicate
  63.  *    a NULL address, as zero is a valid address
  64.  */
  65. struct RigidDiskBlock {
  66.     ULONG   rdb_ID;        /* 4 character identifier */
  67.     ULONG   rdb_SummedLongs;    /* size of this checksummed structure */
  68.     LONG    rdb_ChkSum;        /* block checksum (longword sum to zero) */
  69.     ULONG   rdb_HostID;        /* SCSI Target ID of host */
  70.     ULONG   rdb_BlockBytes;    /* size of disk blocks */
  71.     ULONG   rdb_Flags;        /* see below for defines */
  72.     /* block list heads */
  73.     ULONG   rdb_BadBlockList;    /* optional bad block list */
  74.     ULONG   rdb_PartitionList;    /* optional first partition block */
  75.     ULONG   rdb_FileSysHeaderList; /* optional file system header block */
  76.     ULONG   rdb_DriveInit;    /* optional drive-specific init code */
  77.                 /* DriveInit(lun,rdb,ior): "C" stk & d0/a0/a1 */
  78.     ULONG   rdb_Reserved1[6];    /* set to $ffffffff */
  79.     /* physical drive characteristics */
  80.     ULONG   rdb_Cylinders;    /* number of drive cylinders */
  81.     ULONG   rdb_Sectors;    /* sectors per track */
  82.     ULONG   rdb_Heads;        /* number of drive heads */
  83.     ULONG   rdb_Interleave;    /* interleave */
  84.     ULONG   rdb_Park;        /* landing zone cylinder */
  85.     ULONG   rdb_Reserved2[3];
  86.     ULONG   rdb_WritePreComp;    /* starting cylinder: write precompensation */
  87.     ULONG   rdb_ReducedWrite;    /* starting cylinder: reduced write current */
  88.     ULONG   rdb_StepRate;    /* drive step rate */
  89.     ULONG   rdb_Reserved3[5];
  90.     /* logical drive characteristics */
  91.     ULONG   rdb_RDBBlocksLo;    /* low block of range reserved for hardblocks */
  92.     ULONG   rdb_RDBBlocksHi;    /* high block of range for these hardblocks */
  93.     ULONG   rdb_LoCylinder;    /* low cylinder of partitionable disk area */
  94.     ULONG   rdb_HiCylinder;    /* high cylinder of partitionable data area */
  95.     ULONG   rdb_CylBlocks;    /* number of blocks available per cylinder */
  96.     ULONG   rdb_AutoParkSeconds; /* zero for no auto park */
  97.     ULONG   rdb_HighRDSKBlock;    /* highest block used by RDSK */
  98.                 /* (not including replacement bad blocks) */
  99.     ULONG   rdb_Reserved4;
  100.     /* drive identification */
  101.     char    rdb_DiskVendor[8];
  102.     char    rdb_DiskProduct[16];
  103.     char    rdb_DiskRevision[4];
  104.     char    rdb_ControllerVendor[8];
  105.     char    rdb_ControllerProduct[16];
  106.     char    rdb_ControllerRevision[4];
  107.     char    rdb_DriveInitName[40]; // jdow: Filename for driveinit source
  108.                    // jdow: as a terminated string.
  109. };
  110.  
  111. #define    IDNAME_RIGIDDISK    0x5244534B    /* 'RDSK' */
  112.  
  113. #define    RDB_LOCATION_LIMIT    16
  114.  
  115. #define    RDBFB_LAST    0    /* no disks exist to be configured after */
  116. #define    RDBFF_LAST    0x01L    /*   this one on this controller */
  117. #define    RDBFB_LASTLUN    1    /* no LUNs exist to be configured greater */
  118. #define    RDBFF_LASTLUN    0x02L    /*   than this one at this SCSI Target ID */
  119. #define    RDBFB_LASTTID    2    /* no Target IDs exist to be configured */
  120. #define    RDBFF_LASTTID    0x04L    /*   greater than this one on this SCSI bus */
  121. #define    RDBFB_NORESELECT 3    /* don't bother trying to perform reselection */
  122. #define    RDBFF_NORESELECT 0x08L    /*   when talking to this drive */
  123. #define    RDBFB_DISKID    4    /* rdb_Disk... identification valid */
  124. #define    RDBFF_DISKID    0x10L
  125. #define    RDBFB_CTRLRID    5    /* rdb_Controller... identification valid */
  126. #define    RDBFF_CTRLRID    0x20L
  127.                 /* added 7/20/89 by commodore: */
  128. #define RDBFB_SYNCH    6    /* drive supports scsi synchronous mode */
  129. #define RDBFF_SYNCH    0x40L    /* CAN BE DANGEROUS TO USE IF IT DOESN'T! */
  130.  
  131. /*------------------------------------------------------------------*/
  132. struct BadBlockEntry {
  133.     ULONG   bbe_BadBlock;    /* block number of bad block */
  134.     ULONG   bbe_GoodBlock;    /* block number of replacement block */
  135. };
  136.  
  137. struct BadBlockBlock {
  138.     ULONG   bbb_ID;        /* 4 character identifier */
  139.     ULONG   bbb_SummedLongs;    /* size of this checksummed structure */
  140.     LONG    bbb_ChkSum;        /* block checksum (longword sum to zero) */
  141.     ULONG   bbb_HostID;        /* SCSI Target ID of host */
  142.     ULONG   bbb_Next;        /* block number of the next BadBlockBlock */
  143.     ULONG   bbb_Reserved;
  144.     struct BadBlockEntry bbb_BlockPairs[61]; /* bad block entry pairs */
  145.     /* note [61] assumes 512 byte blocks */
  146. };
  147.  
  148. #define    IDNAME_BADBLOCK        0x42414442    /* 'BADB' */
  149.  
  150. /*------------------------------------------------------------------*/
  151. struct PartitionBlock {
  152.     ULONG   pb_ID;        /* 4 character identifier */
  153.     ULONG   pb_SummedLongs;    /* size of this checksummed structure */
  154.     LONG    pb_ChkSum;        /* block checksum (longword sum to zero) */
  155.     ULONG   pb_HostID;        /* SCSI Target ID of host */
  156.     ULONG   pb_Next;        /* block number of the next PartitionBlock */
  157.     ULONG   pb_Flags;        /* see below for defines */
  158.     ULONG   pb_Reserved1[2];
  159.     ULONG   pb_DevFlags;    /* preferred flags for OpenDevice */
  160.     UBYTE   pb_DriveName[32];    /* preferred DOS device name: BSTR form */
  161.                 /* (not used if this name is in use) */
  162.     ULONG   pb_Reserved2[15];    /* filler to 32 longwords */
  163.     ULONG   pb_Environment[20];    /* environment vector for this partition */
  164.     ULONG   pb_EReserved[12];    /* reserved for future environment vector */
  165. };
  166.  
  167. #define    IDNAME_PARTITION    0x50415254    /* 'PART' */
  168.  
  169. #define    PBFB_BOOTABLE    0    /* this partition is intended to be bootable */
  170. #define    PBFF_BOOTABLE    1L    /*   (expected directories and files exist) */
  171. #define    PBFB_NOMOUNT    1    /* do not mount this partition (e.g. manually */
  172. #define    PBFF_NOMOUNT    2L    /*   mounted, but space reserved here) */
  173.  
  174. /*------------------------------------------------------------------*/
  175. struct FileSysHeaderBlock {
  176.     ULONG   fhb_ID;        /* 4 character identifier */
  177.     ULONG   fhb_SummedLongs;    /* size of this checksummed structure */
  178.     LONG    fhb_ChkSum;        /* block checksum (longword sum to zero) */
  179.     ULONG   fhb_HostID;        /* SCSI Target ID of host */
  180.     ULONG   fhb_Next;        /* block number of next FileSysHeaderBlock */
  181.     ULONG   fhb_Flags;        /* see below for defines */
  182.     ULONG   fhb_Reserved1[2];
  183.     ULONG   fhb_DosType;    /* file system description: match this with */
  184.                 /* partition environment's DE_DOSTYPE entry */
  185.     ULONG   fhb_Version;    /* release version of this code */
  186.     ULONG   fhb_PatchFlags;    /* bits set for those of the following that */
  187.                 /*   need to be substituted into a standard */
  188.                 /*   device node for this file system: e.g. */
  189.                 /*   0x180 to substitute SegList & GlobalVec */
  190.     ULONG   fhb_Type;        /* device node type: zero */
  191.     ULONG   fhb_Task;        /* standard dos "task" field: zero */
  192.     ULONG   fhb_Lock;        /* not used for devices: zero */
  193.     ULONG   fhb_Handler;    /* filename to loadseg: zero placeholder */
  194.     ULONG   fhb_StackSize;    /* stacksize to use when starting task */
  195.     LONG    fhb_Priority;    /* task priority when starting task */
  196.     LONG    fhb_Startup;    /* startup msg: zero placeholder */
  197.     LONG    fhb_SegListBlocks;    /* first of linked list of LoadSegBlocks: */
  198.                 /*   note that this entry requires some */
  199.                 /*   processing before substitution */
  200.     LONG    fhb_GlobalVec;    /* BCPL global vector when starting task */
  201.     ULONG   fhb_Reserved2[23];    /* (those reserved by PatchFlags) */
  202.     char    fhb_FileSysName[84]; /* File system file name as loaded. */
  203. };
  204.  
  205. #define    IDNAME_FILESYSHEADER    0x46534844    /* 'FSHD' */
  206.  
  207. /*------------------------------------------------------------------*/
  208. struct LoadSegBlock {
  209.     ULONG   lsb_ID;        /* 4 character identifier */
  210.     ULONG   lsb_SummedLongs;    /* size of this checksummed structure */
  211.     LONG    lsb_ChkSum;        /* block checksum (longword sum to zero) */
  212.     ULONG   lsb_HostID;        /* SCSI Target ID of host */
  213.     ULONG   lsb_Next;        /* block number of the next LoadSegBlock */
  214.     ULONG   lsb_LoadData[123];    /* data for "loadseg" */
  215.     /* note [123] assumes 512 byte blocks */
  216. };
  217.  
  218. #define    IDNAME_LOADSEG        0x4C534547    /* 'LSEG' */
  219.  
  220. #endif    /* DEVICES_HARDBLOCKS_H */
  221.